package com.cloudeye.sys.manage.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloudeye.sys.manage.entity.Cityinfo;
import com.cloudeye.sys.manage.mapper.CityinfoMapper;
import com.cloudeye.sys.manage.service.CityinfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.PreDestroy;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author echola
 * @since 2020-12-31
 */
@Service
@Slf4j
public class CityinfoServiceImpl extends ServiceImpl<CityinfoMapper, Cityinfo> implements CityinfoService {

    @Override
    public Cityinfo queryByName(String name) {
        List<Cityinfo> list = this.lambdaQuery().like(Cityinfo::getName, name).list();
        return list.size() > 0 ? list.get(0) : null;
    }
    @PreDestroy
    public void preDestory(){
        log.info("关闭前调用......");
    }
}
